/**
 * edurender
 * D3D10Quake3Model.h
 * (c) 2009 J. Brad Byrd
 */

#ifndef ER_D3D10QUAKE3MODEL_H
#define ER_D3D10QUAKE3MODEL_H

#include "Types.h"
#include "Quake3Model.h"

#include "DXUT.h"

namespace er
{
	class RenderState;

	class D3D10Quake3Model
	{
	public:
		static D3D10Quake3Model *Create(Quake3ModelReader *reader, ID3D10Device *device);
		static void Destroy(D3D10Quake3Model *model);
	
	public:
		void Draw(const RenderState &renderState);
	
	private:
		struct Vertex
		{
			D3DXVECTOR3 position;
			D3DXVECTOR3 normal;
		};

	private:
		bool Initialize(er::Quake3ModelReader *reader);

	private:
		ID3D10Device *m_device;
		ID3D10Buffer *m_vb;
		ID3D10Buffer *m_ib;
		ID3D10InputLayout *m_layout;
		ID3D10Effect *m_effect;
		UInt32 m_vertexCount;
		UInt32 m_indexCount;

	private:
		D3D10Quake3Model(ID3D10Device *device);
		~D3D10Quake3Model();
	};
}

#endif // ER_D3D10QUAKE3MODEL_H
